RendererFeatureUtils.cs 519 B

123456789101112131415161718
  1. using UnityEngine;
  2. using UnityEngine.Rendering;
  3. namespace FlatKit {
  4. public static class RendererFeatureUtils {
  5. public static void SetKeyword(Material material, string keyword, bool enabled) {
  6. if (material.shader != null) {
  7. material.SetKeyword(new LocalKeyword(material.shader, keyword), enabled);
  8. } else {
  9. if (enabled) {
  10. material.EnableKeyword(keyword);
  11. } else {
  12. material.DisableKeyword(keyword);
  13. }
  14. }
  15. }
  16. }
  17. }